package com.mmcg.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.session.data.redis.config.annotation.web.http.EnableRedisHttpSession;
import org.springframework.session.web.http.CookieSerializer;
import org.springframework.session.web.http.DefaultCookieSerializer;

@Configuration
@EnableRedisHttpSession
public class MMCGSessionConfig {

	@Bean
	public CookieSerializer cookieSerializer() {
		DefaultCookieSerializer serializer = new DefaultCookieSerializer();
		serializer.setCookieName("MMCG_SESSION");
		serializer.setCookiePath("/");
		// manager.hzit.com portal.hzit.com cart.hzit.com
		serializer.setDomainName("mmcg.com");       // 将来所有的以hzit.com为一级域名的二级域名都可以实现session共享
		return serializer;
	}
}